import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'
import HomeView from '@/views/HomeView.vue'
import SearchView from '@/views/SearchView.vue'
import NotFound from '@/views/NotFoundView.vue'

const routes = [
  // {path: '/home', component: HomeView},
  // {path: '/search', component: SearchView}
  {path: '/home', name:"home", component: HomeView},
  {path: '/', redirect: '/home'}, // 重定向路由
  {path: '/search/:words?', name: 'search', component: SearchView},
  {path: '/:catchAll(.*)', name:"404Page", component: NotFound } //最后一个
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
